import request from '@/utils/request'
// 教师获取作业列表
export function getTaskListApi(query) {
  return request({
    url: `/train/assignment/list`,
    method: 'get',
    params: query
  })
}

// 学生获取作业列表
export function getStudentTaskListApi(query) {
  return request({
    url: `/train/homework/list`,
    method: 'get',
    params: query
  })
}

// 添加作业
export function addTaskApi(data) {
  return request({
    url: `/train/assignment`,
    method: 'post',
    data: data
  })
}
// 修改作业
export function editTaskApi(data) {
  return request({
    url: `/train/assignment`,
    method: 'put',
    data: data
  })
}
// 根据id查询某一个作业的详细内容
export function getTaskDetailApi(taskId) {
  return request({
    url: `/train/assignment/${taskId}`,
    method: 'get',
  })
}

// 删除作业
export function deleteAllApi(assignmentIds) {
  return request({
    url: `/train/assignment/${assignmentIds}`,
    method: 'DELETE',
  })
}

// 批量发布
export function openAllApi(data) {
  return request({
    url: `/train/assignment/openAssignments`,
    method: 'post',
    data: data
  })
}

export function getReadOverTaskListApi(query) {
  return request({
    url: `/train/assignment/studentHomework/list`,
    method: 'get',
    params: query
  })
}

export function getAssignmentTopInfoApi(assignmentId, lessonId ) {
  return request({
    url: `/train/assignment/assignmentTopInfo/${assignmentId}/${lessonId}`,
    method: 'get'
  })
}

export function getHomeworkApi(homeworkId) {
  return request({
    url: `/train/homework/${homeworkId}`,
    method: 'get'
  })
}

export function getStudentListApi(assignmentId) {
  return request({
    url: `/train/homework/getHomeworkIdList/${assignmentId}`,
    method: 'get'
  })
}

export function markNumApi(data) {
  return request({
    url: `/train/homework/markNum`,
    method: 'post',
    data: data
  })
}
// 催交
export function quickSubmitApi(data) {
  return request({
    url: `/train/homework/quickSubmit`,
    method: 'post',
    data: data
  })
}
// 历史记录
export function getHistoryListApi(query) {
  return request({
    url: `/train/history/homeworkList`,
    method: 'get',
    params: query
  })
}
// 一键催交
export function quickSubmitAllApi(data) {
  return request({
    url: `/train/homework/quickSubmitAll`,
    method: 'post',
    data: data
  })
}

// 单个批阅
export function editHomeworkByTeaApi(data) {
  return request({
    url: `/train/homework/editHomeworkByTea`,
    method: 'put',
    data: data
  })
}
// 批量给分
export function batchEditHomeworkByTeaApi(data) {
  return request({
    url: `/train/homework/batchEditHomeworkByTea`,
    method: 'put',
    data: data
  })
}
// 单个打回
export function callbackHomeworkByTeaApi(data) {
  return request({
    url: `/train/homework/callbackHomeworkByTea`,
    method: 'put',
    data: data
  })
}
// 批量打回
export function batchCallbackHomeworkByTeaApi(data) {
  return request({
    url: `/train/homework/batchCallbackHomeworkByTea`,
    method: 'put',
    data: data
  })
}

// 学生提交作业
export function homeworkApi(data) {
  return request({
    url: `/train/homework`,
    method: 'post',
    data: data
  })
}
// 学生修改作业
export function homeworkUpdateApi(data) {
  return request({
    url: `/train/homework`,
    method: 'put',
    data: data
  })
}
// 获取学生作业内容
export function getStudentHomeWorkApi(assignmentId, userId) {
  return request({
    url: `/train/homework/${assignmentId}/${userId}`,
    method: 'get'
  })
}
